home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Super Platinum 8
/
Shareware Super Platinum 8.iso
/
mac
/
PROGTOOL
/
NETPROG.ZIP;1
/
NETPROG.TAR
/
lock
/
locks5.c
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
C/C++ Source or Header
|
1989-12-17
|
333 b
|
22 lines
/*
* Locking routines for System V.
*/
#include <unistd.h>
my_lock(fd)
int fd;
{
lseek(fd, 0L, 0); /* rewind before lockf */
if (lockf(fd, F_LOCK, 0L) == -1) /* 0L -> lock entire file */
err_sys("can't F_LOCK");
}
my_unlock(fd)
int fd;
{
lseek(fd, 0L, 0);
if (lockf(fd, F_ULOCK, 0L) == -1)
err_sys("can't F_ULOCK");
}